package com.tjtt.tdm.system.dao.impl;
import com.tjtt.tdm.base.HibernateEntityDAO;
import com.tjtt.tdm.exception.DaoException;
import com.tjtt.tdm.system.bean.UserRole;
import com.tjtt.tdm.system.dao.UserRoleDao;

public class UserRoleDaoImpl extends HibernateEntityDAO<UserRole> implements UserRoleDao {

	//删除用户角色关联
	public void delUserRoleByRoleId(Long roleId) throws DaoException {
		if(roleId != null){
			String sql = "delete from sys_user_role u where u.roleid ="+roleId;
			this.executeSQL(sql);
		}
	}

	//给角色分配人员
	public void savaUserToRole(UserRole userRole) {
		this.getHibernateTemplate().save(userRole);
	}
	public void delUserRole(Long userId) throws DaoException {
		String sql = "delete from sys_user_role u where u.userid ="+userId;
		this.executeSQL(sql);
	}
}
